package com.wzdigit.wms.wms.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wzdigit.framework.Shift;
import com.wzdigit.framework.exception.RestStatusException;
import com.wzdigit.framework.model.response.ErrorEntity;
import com.wzdigit.wms.basic.domain.mid.IfTransferDtl;
import com.wzdigit.wms.basic.domain.mid.IfTransferHeader;
import com.wzdigit.wms.basic.domain.mid.dtos.IfTransferHeaderDto;
import com.wzdigit.wms.basic.mapper.core.inventory.GoodsMapper;
import com.wzdigit.wms.basic.mapper.core.mid.IfTransferDtlMapper;
import com.wzdigit.wms.basic.mapper.core.mid.IfTransferHeaderMapper;
import com.wzdigit.wms.basic.service.code.InventoryService;
import com.wzdigit.wms.wms.constant.WmsWareConstant;
import com.wzdigit.wms.wms.http.ChatHttpClient;
import com.wzdigit.wms.wms.service.mid.IfTransferHeaderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.dreamlu.mica.core.utils.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@Api(tags = "企业微信测试")
@RequestMapping(value = WmsWareConstant.API_VERSION)
public class ChatTestController {

    private final String REQUEST_MODEL = "/zyf";
    @Autowired
    private ChatHttpClient chatHttpClient;



    /**
     * @param billNo
     * @param servletRequest
     * @param servletResponse
     */
    @ApiOperation(value = "测试1", notes = "测试1")
    @ApiResponses({@ApiResponse(code = 500, message = "系统出现异常", response = ErrorEntity.class)})
    @RequestMapping(value = REQUEST_MODEL + "/test1", method = RequestMethod.GET)
    public String test1(
                       HttpServletRequest servletRequest,
                       HttpServletResponse servletResponse) {
        String token = chatHttpClient.getToken();
        chatHttpClient.deleteTokenCache();
        return token;
    }

    @ApiOperation(value = "测试2", notes = "测试2")
    @ApiResponses({@ApiResponse(code = 500, message = "系统出现异常", response = ErrorEntity.class)})
    @RequestMapping(value = REQUEST_MODEL + "/test2", method = RequestMethod.GET)
    public String test2(
            HttpServletRequest servletRequest,
            HttpServletResponse servletResponse) {
        String token = chatHttpClient.getToken();
        chatHttpClient.deleteTokenCache();
        return token;
    }

    @ApiOperation(value = "测库存", notes = "测库存")
    @ApiResponses({@ApiResponse(code = 500, message = "系统出现异常", response = ErrorEntity.class)})
    @RequestMapping(value = REQUEST_MODEL + "/test3", method = RequestMethod.GET)
    public String test3 (
            HttpServletRequest servletRequest,
            HttpServletResponse servletResponse) throws Exception{

        chatHttpClient.testinv();
        return "p2zui";
    }

}
